home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / postnt.zip / POSTNT.DOC < prev    next >
Text File  |  1990-02-25  |  7KB  |  182 lines

  1.                             POSTNT.EXE                   02-25-90
  2.                       A Brief(?) Explanation
  3. Background
  4.  
  5. Some years ago the US Postal Service began a program to automate the
  6. handling of the mail. Part of this program involves optical character
  7. readers which attempt to read the address on a letter and then spray
  8. a barcode (using an ink-jet printer) on the letter. The barcode
  9. represents the ZIP+4 for that address. Barcoded letters are in turn
  10. sorted by barcode sorting equipment.
  11.  
  12. This barcode is called a POSTNET code. POSTNET is an acronym for
  13. POSTal Numeric Encoding Technique. POSTNET is essentially a binary
  14. code used to represent numbers. POSTNET differs from other commonly
  15. used barcodes such as 2 of 5, code 39 , or UPC. POSTNET barcodes
  16. consist of a series of tall and short bars, whereas the other barcodes
  17. mentioned are combinations of wide or narrow bars and spaces.
  18.  
  19. POSTNET uses a series of 5 bars, 2 tall and 3 short, in various combinations
  20. to represent the digits 0 through 9. In decoding a POSTNET barcode the tall
  21. bars are viewed as '1' and the short bars are '0' and the relative position
  22. of the '1' or '0' determines the actual value of the code.
  23. Below is a representation of a POSTNET barcode.
  24.  
  25.       │     │
  26.    │  │  │  │  │        (barcode)
  27.  
  28.    7  4  2  1  0        (position value left to right)
  29.  
  30. To decode this barcode add the position values under the TALL bars (remember
  31. the short bars have no value). There is a tall bar over the 4 and a tall bar
  32. over the 1, therefore this POSTNET barcode represents a 5.
  33.  
  34. There is one exception to this rule and that is the barcode for 0 (zero).
  35. Below is a representation of the POSTNET barcode for 0 (zero).
  36.  
  37.    │  │
  38.    │  │  │  │  │        (barcode)
  39.  
  40.    7  4  2  1  0        (position value left to right)
  41.  
  42. Since each group of 5 bars represents 1 digit and the sum of the position
  43. values in the above barcode is 11, this combination of bars is always
  44. understood to represent the digit 0 (zero).
  45.  
  46. POSTNET barcodes also include a check digit and leading and trailing tall
  47. bars which are called frame bars. Frame bars merely tell the barcode
  48. reading equipment when the barcode starts and stops. A check digit is used
  49. in case some part of the barcode becomes unreadable (smeared, etc.).
  50. Below is a representation of a POSTNET barcode for St. Paul, MN 55101,
  51. including the leading and trailing frame bar and the check digit.
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  │   │   │     │   │         │ │ │ │             │ │ │     │   │
  71.  │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
  72.    --------- _________ --------- _________ --------- *********
  73.  F     5         5         1         0         1         8*    F
  74.  r                                                     check   r
  75.  a                                                     digit   a
  76.  m                                                             m
  77.  e                                                             e
  78.  
  79. This barcode starts with the leading frame bar, then 5 groups of 5 bars each
  80. which represent the digits of the ZIPcode (55101), then the check digit 8 and
  81. finally the trailing frame bar
  82.  
  83. The check digit is the result of the following calculation:
  84.  
  85.   1) add the digits of the ZIPcode
  86.   2) this number is divided by modulo 10
  87.   3) the remainder from the previous step is subtracted from ten
  88.   4) the result is the check digit.
  89.  
  90. In the case of the example 55101:
  91.  
  92.   1) 5+5+1+0+1=12
  93.   2) 12 MOD 10 = 2
  94.   3) 10-2=8
  95.   4) the check digit for ZIP 55101 is 8
  96.  
  97. Why in the world ...???
  98. Using the example above let's see what happens if one of the groups of
  99. bars in a barcode becomes unreadable.
  100.  
  101.  │   │   │   X X X X X       │ │ │ │             │ │ │     │   │
  102.  │ │ │ │ │ │ X X X X X │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
  103.    --------- _________ --------- _________ --------- *********
  104.  F     5         ?         1         0         1         8*    F
  105.  r                                                     check   r
  106.  a                                                     digit   a
  107.  m                                                             m
  108.  e                                                             e
  109.  
  110. The group of bars which represented the second 5 in the barcode has become
  111. unreadable. Can we still use this barcode to determine the ZIPcode?
  112. Yes, and the method uses the check digit. To determine the missing digit
  113. do the following:
  114.  
  115.   1) add the digits of the readable portion of the barcode
  116.   2) this sum is divided by modulo 10
  117.   3) the remainder is subtracted from 10
  118.   4) the result is the missing digit
  119.  
  120.   1) 5+1+0+1+8=15
  121.   2) 15 MOD 10 = 5
  122.   3) 10-5=5
  123.   4) the missing digit is 5
  124.  
  125. 9 digit ZIPcodes (ZIP+4) work exactly the same way except, of course, they
  126. have more bars in the barcode.
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. There are several other specifications for the POSTNET barcode aside from this
  137. quick(?) explanation. If you wish to have more detailed information have your
  138. local Post Office get you a copy of USPS publication 25. Smaller offices may
  139. not be familiar with this item but you should be able to obtain it through
  140. the Marketing Department or the Automation Readability Specialist in larger
  141. offices.
  142.  
  143.  
  144.  
  145.  
  146. The program
  147.  
  148. POSTNT was written as an exercise. The intent was to produce a program
  149. which could print US Postal Service POSTNET barcodes that could be used
  150. for demonstration and information purposes. As it turned out, the barcodes
  151. actually are 'readable' on a barcode sorter. The program works with an
  152. 'IBM' compatible graphics printer.
  153.  
  154. To run the program simply type POSTNT and the ZIPcode you want printed as
  155. a barcode.
  156. POSTNT works with 5 digit ZIPs  e.g. 55101
  157. 9 digit ZIPs (ZIP+4)            e.g. 55101-9306  or  551019306
  158.  
  159. The program also prints "B field" barcodes which are a combination of a
  160. 5 digit barcode, a space of about a quarter inch, and then six additional
  161. digits in barcode form. The explanation of "B field" barcodes would try
  162. your patience beyond the limit. If you are really interested in these types
  163. of barcodes please contact me.
  164.  
  165.  
  166. POSTNT.EXE was written by Dave Barrett, CS 76314,1004
  167. This program is put in the public domain with the following
  168. conditions:
  169. 1) If you make any improvements to the program please post them
  170.    so others can enjoy them.
  171. 2) This program must be distributed without charge whether used
  172.    alone or included as part of another program.
  173. 3) Please include this file, POSTNT.DOC, along with the program.
  174.  
  175.  
  176. Dave Barrett   CS 76314,1004
  177. 13760 80th St So
  178. Hastings MN 55033-9407
  179.  
  180. (D) 612-293-3318
  181. (E) 612-436-6970
  182.